Device and method for increasing the security of a database

ABSTRACT

The security of a database is substantially increased by partitioning raw data, irreversibly encrypting the partitioned raw data., reversibly encrypting the raw data, and then storing pairs of irreversibly encrypted data and reversibly encrypted data. In response to a search query, the query is partitioned and irreversibly encrypted, and the irreversibly encrypted query is used to search the stored irreversibly encrypted data. When a match is found, the reversibly encrypted data paired with the stored irreversibly encrypted data that matches the irreversibly encrypted query is output in response to the search query.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to Chinese Patent Application No. 201711116308.2, filed on Nov. 13, 2017, which is incorporated herein by reference in its entirety.

BACKGROUND OF THE INVENTION Field of the Invention

The present application relates to data processing and, in particular, to a device and method for increasing the security of data processing, e.g., a database.

Currently, a database can be used for performing data storage tasks. When querying data from a database, one can use keywords as the basis for querying. In the prior art, when an encrypted storage is used, one cannot use substring matching to query the storage content after a database is encrypted. This is because the data content is now represented as ciphertext. Therefore, an Index dictionary can be pre-established for the ciphertext in the database. That is, indexes of keywords to each ciphertext are respectively established and saved in the index dictionary. During a keyword search process, the index dictionary is queried so as to further locate data having the keyword.

Another method used in the prior art is as follows: before a keyword search is conducted, ail data in the database can be decrypted; and then a keyword search is performed on the basis that all the data is plain text.

SUMMARY OF THE INVENTION

The present invention provides a data processing method that substantially increases the security of a database or data structure. The method includes receiving a string of raw data, and partitioning the string of raw data to form a plurality of raw substrings. The method also includes irreversibly encrypting the plurality of raw substrings to form a plurality of irreversibly encrypted substrings. In addition, the method also includes reversibly encrypting the string of raw data to form a string of reversibly encrypted raw data. Further, the method includes associating the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring is associated with the string of reversibly encrypted raw data. The method additionally includes storing the plurality of irreversibly encrypted substrings as a plurality of stored irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each irreversibly encrypted substring as a stored reversibly encrypted string.

The present invention also includes a non-transitory computer-readable storage medium having embedded therein program instructions, which when executed by a processor, causes the processor to execute a method of data processing. The method includes receiving a string of raw data, and partitioning the string of raw data to form a plurality of raw substrings. The method also includes irreversibly encrypting the plurality of raw substrings to form a plurality of irreversibly encrypted substrings. In addition, the method also includes reversibly encrypting the string of raw data to form a string of reversibly encrypted raw data. Further, the method includes associating the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring Is associated with the string of reversibly encrypted raw data. The method additionally includes storing the plurality of irreversibly encrypted substrings as a plurality of stored irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each Irreversibly encrypted substring as a stored reversibly encrypted string.

The present invention further includes a data device. The data device includes a memory that stores instructions and data in a data structure, and a processor coupled to the memory. The processor to receive a string of raw data, and partition the string of raw data to form a plurality of raw substrings. The processor to further irreversibly encrypt the plurality of raw substrings to form a plurality of irreversibly encrypted substrings. In addition, the processor to reversibly encrypt the string of raw data to form a string of reversibly encrypted raw data. Further, the processor to associate the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring is associated with the string of reversibly encrypted raw data. The processor to additionally store the plurality of irreversibly encrypted substrings as a plurality of stored irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each irreversibly encrypted substring as a stored reversibly encrypted string.

A better understanding of the features and advantages of the present invention will be obtained by reference to the following detailed description and accompanying drawings which set forth an illustrative embodiment in which the principals of the invention are utilized.

BRIEF DESCRIPTION OF THE DRAWINGS

The drawings described herein are provided for further understanding of the present application, and form a part of the present application. The exemplary embodiments of the present application and the description thereof are for explaining the present invention and do not constitute an undue limitation to the scope of the present invention.

FIG. 1 is a flowchart illustrating an example of a method 100 of operating a database in accordance with the present invention.

FIG. 2 is a flowchart illustrating an example of a method 200 of operating a client device in accordance with the present invention.

FIG. 3 is a flowchart illustrating an example of a method 300 of querying a database in accordance with the present invention.

FIG. 4 is a flowchart illustrating an example of a method 400 of implementing step 340 in accordance with the present invention.

FIG. 5 is a block diagram illustrating a data device 500 in accordance with the present invention.

FIG. 6 is a block diagram illustrating a data device 600 in accordance with the present invention.

DETAILED DESCRIPTION OF THE INVENTION

The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It is apparent that the described embodiments are merely some, rather than all of the embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments in the present application without inventive efforts shall fall within the protection scope of the present application.

As described in greater detail below, the methods of data encryption, decryption, and query of the present invention can be applied to, for example, (1) encrypted storage and fuzzy query of data, (2) encryption and query of long text, and (3) encrypted storage and query of DNA (deoxyribonucleic acid) sequence fragments.

For example, in a relational database, the short text data in the database (e.g., sensitive fields and the like) that needs to be encrypted can be done directly using the data encryption method in the present application. After these sensitive fields have been encrypted, the encrypted sensitive fields can be queried with the query method of the present application. For example, a LIKE operator in Structured Query Language (SQL) can be used to retrieve a matching substring.

In addition, for the encryption and query of long text data, the long text data can first be partitioned using, for example, sliding window partitioning, to obtain a number of substrings. Following this, each substring is encrypted. In addition, each encrypted substring is located to determine a position of a certain substring appearing in the long text.

For the encrypted storage and query of a DNA sequence fragment, because the sequence is a string, the sequence string can be partitioned using, for example, sliding window partitioning, to obtain a number of subsequences. After this, each subsequence is then encrypted. Whether or not a specific fragment is present on an inputted DNA can then be determined so as to achieve medical purposes such as diagnosis. Because the inputted DNA is usually encrypted to ensure the privacy of the patient, the specific fragment can be encrypted with the present method so that the encrypted specific fragment can be used for the query.

FIG. 1 shows a flowchart that illustrates an example of a method 100 of operating a database in accordance with the present invention. As shown in FIG. 1, method 100 begins at step 110 by partitioning a string/sequence of raw data obtained from a source into a number of substrings/subsequences of raw data. In the present example, the source can be a database or other data structure, and the raw data can be data stored in and obtained from the database or other data structure. For example, if 100 pieces of address information are stored In a database, then the 100 pieces of address information are the to-be-encrypted raw data.

The string/sequence of raw data is partitioned into multiple substrings/subsequences of raw data according to a preset partitioning rule. For example, the preset partitioning rule can be a sliding window, and the foregoing 100 pieces of address information can be respectively partitioned into a series of sub-address information using a sliding window with a size x. The length of the sliding window can be either fixed or variable.

When a fixed-length sliding window is to be used to partition the data, the length of the sliding window is determined, and a string/sequence of raw data is partitioned, according to the fixed length of the sliding window, into a series of substrings/subsequences of raw data. Each substring/subsequence of raw data can include one or more pieces of raw data.

For example, assume that the string/sequence of raw data is “A, G, K, B, Z, N, E, K, S, W, H,” and the length of the sliding window is four characters. In this case, the characters in the first sliding window are “A, G, K, B, ” and the characters in the second sliding window, which slides from left to right by one character, is “G, K, B, Z.” Following the same line of reasoning, the characters in the third sliding window are “K, B, Z, N,” and the characters in the rest of the sliding windows can be obtained following the same method The partitioning of the raw data stops when the character in the last sliding window has been obtained.

Further, when the partitioned substrings/subsequences are subsequently encrypted, the four characters “A, G, K, B” in the first sliding window are encrypted to form an encrypted substring/subsequence “agkb. ”. Similarly, the four characters “G, K, B, Z” in the second sliding window are encrypted to form an encrypted substring/subsequence “gkbz,” and the characters “K, B, Z, N,” in the third sliding window are encrypted to form an encrypted substring/subsequence “bbzn.” The rest of the encrypted substrings/subsequences can be obtained using the same manner.

With respect to a variable sliding window, this type of window can include, for example, at least two Chinese characters, four English letters or numbers, or one Chinese character plus two English letters or numbers. Specifically, when raw data is partitioned according to a sliding window, assuming that a starting position of the sliding window is s and an ending position of the sliding window is e, then all the raw data, such as characters, between s and e (including the s position and the e position) is a window.

First, assuming that s=1 and e gradually increases from 1 until a minimum length requirement of the sliding window has been satisfied. The characters between s and e at this time are taken as a first window W(n), where n=1. Then, during sliding of the sliding window, if e is already the last character and the length of the window is not greater than the minimum length requirement, then the current window is already the last window and the partitioning of the raw data therefore stops.

Otherwise, n=n+1, and the n^(th) window is calculated. If the current window satisfies the minimum length requirement, the next position after the window is not an alphanumeric, and the first position In the window is an alphanumeric, then s remains the same and e moves to the right by one character. Otherwise, s moves to the right: by one character and e moves to the right until the window satisfies the minimum length requirement again, which is the next window W(n).

For example, if the string/sequence of raw data is “Y, 3, C, φ, ω, δ, A, θ, B, λ, β, C, C, C, ψ, μ, C,” (where the Greek letters represent Chinese characters) (no space is Included between any of the Chinese and English characters), then the substrings/subsequences are obtained by partitioning using a variable-length sliding window (the sliding window should have at least two Chinese characters, four English letters, or one Chinese character plus 2 English letters or numbers) are respectively: [“Y3Cφ”], [“3Cφ”], [“C φω”], [“φω”], [“ωδ”], [“ωδA”], [“δAθ”], [“θBγ”], [“γβ”], [“γβC”], [“βCC”], [“βCCC”], [“CCCψ”], [“CCψ”], [“Cψμ”], [“ψμ”], and [“ψμC”]. No space is included between any Chinese and English characters in each partitioned substring/subsequence.

TABLE 1 Substring Serial Number Y3Cφ 1 3Cφ 2 Cφω 3 Φω 4 Ωδ 5 ωδA 6 δAθ 7 AθB 8 θBλ 9 Λβ 10 λβC 11 βCC 12 βCCC 13 CCCψ 14 CCψ 15 Cψμ 16 ψμ 17 ψμC 18

As shown in Table 1, 18 substrings have been obtained by partitioning the string/sequence of raw data “Y, 3, C, φ, ω, δ, A, θ, B, δ, β, C, C, C, ψ, μ, C” according to a variable-length sliding window. In each substring/subsequence, an English character occupies one position, a Chinese character occupies two positions, and each substring/subsequence has a length of at least two Chinese characters, four English letters or numbers, or one Chinese character plus two English letters or numbers.

In practical applications, the length of the sliding window cannot be too short. If it is too short, the security of encrypting raw data can be compromised. If the sliding window is one character long, then step 110 would encrypt characters one by one. At the same time, the length of the sliding window cannot be too long. When a substring is queried, the substring needs to be queried after being encrypted according to this embodiment.

A substring shorter than the length of the sliding window cannot be encrypted. Therefore, if the length of the sliding window is too long, it limits the minimum length the substrings might have. If the length of the sliding window is the length of the string/sequence of raw data, then step 110 directly encrypts the string/sequence of raw data rather than partitioning and encrypting substrings/subsequences. Following that, a query of substrings cannot be done subsequently.

In practical applications, the length of the sliding window is also related to the collision rate. In this case, a collision means that the same “encryption” results can be obtained with different substrings. The consequence of the collision is that when substring matching is performed, a result other than the desired query result can be output.

The collision rate is used to indicate the magnitude of a probability obtained for the outputted results different from the desired query results, and is explained below through theoretical calculations and experimental data. When encryption is performed by way of the embodiments of the present application, the collision rate is not particularly high. Thus, the case where too much data needs to be filtered out can be reduced.

A first experiment illustrates the effect of the length of the sliding window on the collision rate. When a theoretical collision rate is calculated, a mapping from N variables to M values may be considered, where N and M are respective integers greater than zero. Then if any variable is mapped, the probability obtained when there are k values (k Is an integer greater than zero) colliding with It. is as shown in equation (I);

$\begin{matrix} {\left( {1 - \frac{1}{M}} \right)^{N - k} \cdot \left( \frac{1}{M} \right)^{K - 1} \cdot \begin{pmatrix} N \\ {k - 1} \end{pmatrix} \cdot \frac{1}{k}} & {{Equation}\mspace{14mu} (I)} \end{matrix}$

Specifically, when k=1, i.e., one variable is mapped. The probability obtained when there is no collision is as shown in equation (II):

$\begin{matrix} {\left( {1 - \frac{1}{M}} \right)^{N - 1} \approx \left( \frac{1}{e} \right)^{N\text{/}M}} & {{Equation}\mspace{14mu} ({II})} \end{matrix}$

When is relatively small, this probability is relatively large.

In practical applications, assuming that a fixed sliding window is used with common Chinese characters and is two Chinese characters long. In the first experiment, considering combinations of every two adjacent Chinese characters of nearly 3,000 common Chinese characters, a total of 8.62 million substrings therefore exist, wherein each substring is two Chinese characters.

In the first experiment, the substrings with different compressed output windows are output, and the collision probability is calculated. When the length of the compressed output window is 3, 4, 5, and 6 bytes, respectively, the collision rates are shown in Table 2.

TABLE 2 Number of collisions Maximum number of (a total of 8.62 collisions in 99.9% of cases million Chinese (a total of 8.62 million Compressed characters, two Collision Average number Chinese characters, two output bytes words per unit) rate of collisions words per unit) 3 3.46 Million 40.20% 1.513 5 4 17313 0.200% 1.002 2 5 66 0.00076% 1.000 1 6 2 0.000022% 1.000 1

Based on the content of Table 2, one can see that when the length of the output window is four bytes, the collision rate is already very low, and in 99.9% of the cases, at most two outputted results appear to collide with each other. When the length of the output window is five bytes and above, no collisions occur in 99.9% of the cases.

A second experiment also illustrates the effect of the length of the sliding window on the collision rate. In the second experiment, a variable-length sliding window is used and the substrings are a combination of Chinese characters with English letters. In the second experiment, the variability of the length of the sliding window is limited as follows: the sliding window can at least comprise no less than two Chinese characters or four letters or numbers.

Therefore, for a total of 25.39 million substrings, the substrings with different compressed output: windows are outputted, which are 3, 4, 5, and 6 bytes long, respectively. The collision rate is calculated. When the number of output bytes are 3, 4, 5, and 6 respectively, the collision rates are shown in Table 3.

TABLE 3 Maximum number of Number of collisions collisions in 99.9% of the Compressed (25.39 million pieces Collision Average number cases (25.39 million output bytes of data in total) rate of collisions pieces of data in total) 3 19.81 million 78.00% 2.514 7 4 149435 0.589% 1.006 2 5 622 0.00244% 1.000 1 6 2 0.00000787% 1.000 1

Based on the content of Table 3, one can see that when the length of the output window is four bytes, the collision rate Is already very low, which is about 0.6%. In addition, in the case of the maximum number of conflicts in 99.9% of the cases, at most two outputted results appear collide with each other. When the length of the output window is five bytes and above, no collisions occur in 99.9% of the cases.

Thus, in this embodiment, the length of the sliding window can be either fixed or variable as long as a substring compatibility property is satisfied. Herein, assuming that a sliding window output of a string T is W(T) and assuming that any of its ma tenable substrings t satisfies a requirement that the output W(t) of the sliding window is a substring of W(T), then it is considered that the sliding window has the substring compatibility.

Hence, the fixed-length sliding window obviously has the substring compatibility. In addition to the fixed-length sliding window, the variable-length sliding window can also be used, For example, the sliding window can include at least two Chinese characters, four English letters or numbers, or one Chinese character plus two English letters or numbers. Many variable sliding windows like this exist; and the use of one of them can also ensure the substring compatibility.

Referring again to FIG. 1, after partitioning the raw data, method 100 moves from step 110 to step 120 to encrypt, with an irreversible encryption algorithm, the number of substrings/subsequences of raw data to obtain a corresponding number of irreversibly encrypted substrings/subsequences. In this way, storage and query can be implemented on the basis of the irreversibly encrypted substrings/subsequences, thereby enhancing the security of data storage and query.

The irreversible encryption algorithm can be, for example, a hash algorithm having a key. For example, an “hmac algorithm” such as the “hmac AES” algorithm can be used to perform encryption. Each substring/subsequence of raw data could be encrypted using a hash encryption algorithm having a key so as to ensure that the encrypted data is un-decryptable. For example, if 100 pieces of address information exist and each piece of address information is partitioned by using a fixed-length sliding window to obtain 100 corresponding encrypted sets of data, each one of the 100 sets of data corresponding with each piece of address information.

It can be seen that in the embodiment of the present application, the string/sequence of raw data can be partitioned by using a preset partitioning rule to obtain multiple substrings/subsequences of raw data. For example, a fixed-length sliding window can be used to partition the raw data to obtain multiple windows of substrings/subsequences of raw data.

After this, the multiple substrings/subsequences of raw data are encrypted with an irreversible encryption algorithm to form multiple irreversibly encrypted substrings/subsequences. In this way, when the irreversibly encrypted substrings/subsequences are subsequently queried, the query word can be first partitioned by means of the sliding window, and then irreversibly encrypted so that a irreversibly encrypted sub-query word can directly query the irreversibly encrypted substrings/subsequences, thus ensuring the security of the raw data.

Following this, method 100 moves to step 130 to encrypt, according to a reversible encryption algorithm, the string/sequence of raw data (the same string/sequence of raw data that was obtained from a source and partitioned into a number of substrings/subsequences of raw data in step 110) to obtain a string/sequence of reversibly encrypted raw data.

Thus, in this embodiment, in addition to irreversibly encrypting each substring/subsequence of raw data using a hash algorithm having a key, a reversible encryption algorithm is also used to directly encrypt the raw data, thereby obtaining a string/sequence of reversibly encrypted raw data. In practical applications, each irreversibly encrypted substring/subsequence is paired with the string/sequence of reversibly encrypted raw data to form final output data. The reversible encryption algorithm used in this step can be, for example, an AES128 algorithm or the like, as long as it is a de-cryptable encryption algorithm.

After this, method 100 moves to step 140 to associate the number of irreversibly encrypted substrings/subsequences with the string of reversibly encrypted raw data such that each irreversibly encrypted substring/subsequence is associated with the string of reversibly encrypted raw data.

With the above method, the raw data is partitioned into multiple substrings/subsequences, which are then irreversibly encrypted to form multiple irreversibly encrypted substrings/subsequences. In addition, the raw data is also reversibly encrypted to form a string/sequence of reversibly encrypted raw data. The multiple irreversibly encrypted substrings/subsequences and the string/sequence of reversibly encrypted raw data are spliced together to form multiple final output data sets where each irreversibly encrypted substring/subsequence is paired with the string/sequence of reversibly encrypted raw data to form final output data.

After this, method 100 moves to step 150 to compress each irreversibly-encrypted substring/subsequence and the paired string/sequence of reversibly encrypted raw data to form compressed pairs of data. In practical applications, since an irreversibly encrypted substring/subsequence and the paired string/sequence of reversibly encrypted raw data can be relatively large, the output length of hash encryption is generally 128 bits. A compression algorithm can be used to reduce the output data to a shorter length.

In this step, the compression algorithm can adopt a deflate algorithm such as gzip, zlib, or a graphic, format png, as long as the irreversibly encrypted substring/subsequence and the paired string/sequence of reversibly encrypted raw data can be compressed and the overall output data has a shorter length. The compression algorithm is not limited in the embodiment of the present application. The embodiment of the present application further provides a data storage device that can be used for storing each irreversibly encrypted substring/subsequence and the paired string/sequence of reversibly encrypted raw data.

After compression, which is a preferred but optional step, method 100 moves to step 160 to store the compressed pairs of data (or store each uncompressed irreversibly encrypted substring/subsequence and the paired string/sequence of reversibly encrypted raw data when method 100 moves directly from step 140 to step 160) in a database or data structure.

With the above method, a string/sequence of raw data is first partitioned into multiple, substrings/subsequences of raw data, and then irreversibly encrypted to form multiple irreversibly encrypted substrings/subsequences. In addition, the string/sequence of raw data is also reversibly encrypted to form a string/sequence of reversibly encrypted raw data. Following this, each irreversibly encrypted substring/subsequence is paired with the string/sequence of reversibly encrypted raw data, and stored as an associated pair.

A search query is also partitioned and irreversibly encrypted to form irreversibly encrypted sub-queries, with an irreversibly encrypted sub-query used to locate a matching stored irreversibly encrypted substring/subsequence. Once a matching stored irreversibly encrypted substring/subsequence has been found, the matching stored irreversibly encrypted substring/subsequence and the associated string/sequence of reversibly encrypted raw data can be output in response to the query, where the recipient can decrypt the reversibly encrypted string/sequence.

FIG. 2 shows a flowchart that illustrates an example of a method 200 of operating a client device in accordance with the present invention. As shown in the FIG. 2 example, method 200 begins at step 210 by receiving a series of data pairs where each data pair includes an irreversibly encrypted substring/subsequence and a string/sequence of reversibly encrypted raw data (and decompressing the series of data pairs when compressed) in response to a submitted search query.

After this, method 200 moves to step 220 to separate the data pairs, and then step to step 230 to decrypt, according to a reversible encryption algorithm, the string/sequence of reversibly encrypted raw data to obtain the original string/sequence of raw data. In this embodiment, the irreversibly encrypted substrings/subsequences are un-decryptable. Therefore, only the string/sequence of reversibly encrypted raw data is decrypted to obtain the original string/sequence of raw data.

FIG. 3 shows a flowchart that illustrates an example of a method 300 of querying a database in accordance with the present invention. As shown in the FIG. 3, example, method 300 begins at step 310 by receiving an input query word from a user. For example, if the user inputs “Hanqzhou City”, then the query word is “Hangzhou City”.

After receiving the query word, method 300 moves to step 320 to partition the query word to form a series of sub-query words. The query word is partitioned according to the size of the fixed sliding window used when partitioning the raw data as described in method 100. For example, if the size of the fixed sliding window is two Chinese characters, then “ωγφ” is partitioned into two substrings that include “ωγ” and “γφ.”

Following this, method 300 moves to step 330 to encrypt, according to an irreversible encryption algorithm, the series of sub-query words to form a series of irreversibly encrypted sub-query words. The irreversible encryption of the sub-query words are performed with the same irreversible encryption algorithm used for irreversibly encrypting the substrings/subsequences obtained from partitioning the string/sequence of raw data. For example, a hash encryption algorithm having a key can be used, in the present example, the two substrings “ωγ” and “γφ” are Irreversibly encrypted.

Method 300 next moves to step 340 to match the irreversibly encrypted sub-query word against stored irreversibly encrypted substrings/subsequences to obtain query result data. The stored irreversibly encrypted substrings/subsequences are obtained by partitioning a string/sequence of raw data into a series of substrings/subsequence, and then irreversibly encrypting the substrings/subsequences with an irreversible encryption algorithm. In this step, an ordinary string matching algorithm can be used to match the Irreversibly encrypted sub-query word against the stored irreversibly encrypted substrings/subsequences, The matching results are used as the query result data,

FIG. 4 shows a flowchart that illustrates an example of a method 400 of implementing step 340 in accordance with the present invention. As shown in FIG. 4, method 400 begins at step 410 where the stored irreversibly encrypted substrings/subsequences are searched with an irreversibly encrypted sub-query word to find one or more stored irreversibly encrypted substrings/subsequences that match the irreversibly encrypted sub-query word.

After the stored irreversibly encrypted substrings/subsequences that match the irreversibly encrypted sub-query word have been identified, method 400 moves to step 420 to determine if more than one stored Irreversibly encrypted substring/subsequence matched the irreversibly encrypted sub-query word. When only one stored irreversibly encrypted substring/subsequence matches the irreversibly encrypted sub-query word, method 400 moves to step 430 to add the stored irreversibly encrypted substring/subsequence and associated stored string/sequence of reversibly encrypted raw data to the query result data.

When more than one stored irreversibly encrypted substring/subsequence matches the irreversibly encrypted sub-query word, method 400 moves to step 440 to decrypt the strings/sequences of reversibly encrypted raw data associated with the stored Irreversibly encrypted substrings/subsequences that match the irreversibly encrypted sub-query word to form a number of decrypted strings/sequences.

Following this, method 400 moves to step 450 to determine which of the decrypted strings/sequences match the unencrypted query word. Method 400 then moves to step 460 where, for each match, method 400 adds the corresponding irreversibly encrypted substring/subsequence and associated string/sequence of reversibly encrypted raw data to the query result data.

For example, if there are five stored strings/sequences of reversibly encrypted raw data that are associated with five stored irreversibly encrypted substrings/subsequences that match an irreversibly encrypted sub-query word, then the five stored strings/sequences of reversibly encrypted raw data are decrypted to obtain five decrypted strings/sequences of raw data. The five decrypted strings/sequences of raw data are then matched against the unencrypted query word that was partitioned to form the sub-query words.

If it is found that all of the five decrypted strings/sequences of raw data are matched, if indicates that the five decrypted strings/sequences of raw data are all successfully verified. If it is found that four decrypted strings/sequences of raw data are not matched, it indicates that the four decrypted strings/sequences of raw data did not pass verification.

If all of the five decrypted strings/sequences of raw data are successfully verified, then they are all used as the query result data. If four decrypted strings/sequences of raw data do not pass the verification and one does, then the remaining one decrypted string/sequence of raw data is used as the query result data.

In this embodiment, when data encryption is performed, raw data is first partitioned into a number of sub-data units according to a preset partitioning rule, e.g., the length of each sub-data unit is the same. Each partitioned sub-data unit is then irreversibly encrypted and stored as stored irreversibly encrypted sub-data unit. A hash encryption algorithm having a key can be used to Irreversibly encrypt the sub-data unit.

Moreover, during a subsequent query, a query word is first partitioned into sub-query words according to the same preset partitioning rule, irreversibly encrypted, and then the irreversibly encrypted sub-query words are matched against stored Irreversibly encrypted sub-data units, thereby implementing an encrypted query. Compared with the prior art, the querying data technique according to the present Invention has high security.

Moreover, encryption is also performed once on the raw data according to a reversible encryption algorithm to form a reversibly encrypted data unit. When it is necessary to verify whether a matching irreversibly encrypted sub-data unit is accurate, the associated reversibly encrypted data unit can be decrypted and compared to the corresponding unencrypted query word to be directly verified and Implement the filtering of the unwanted data, thereby ensuring the accuracy of query results. Furthermore, compared with the prior art, the method of the present invention does not need to decrypt all the reversibly encrypted sub-data units, and does not include an index dictionary established additionally. The query efficiency is also improved and the storage space taken by the index dictionary is saved at the same time.

In practical applications, it should be further noted that if the query method is applied to a terminal, then after receiving a data query request of a user, the terminal sends to a server a query word included in the data query request. The server searches for the query word according to the method as shown in FIG. 4, and returns query results to the terminal. The terminal then displays the query results on a query result page.

In order to describe each foregoing method embodiment in a concise manner, all the method embodiments have been described as a combination of a series of actions; but those skilled in the art should know that the present application is not limited by the sequence of the described actions. Certain steps can be applied with different sequences or can be carried out at the same time according to the present application. Secondly, those skilled in the art should also know that all the embodiments described in the description belong to preferred embodiments. The related actions and modules are not necessarily needed for the present application.

FIG. 5 shows a block diagram that illustrates a data device 500 in accordance with the present invention. As shown in FIG. 5, device 500 includes a memory 510 that stores instructions and data in a database or data structure, a processor 512 coupled to memory 510, and a communication interface 514, which connected to processor 512 via a communication bus 516.

In operation, processor 512 partitions raw data into sub-data units, such as with a sliding window, irreversibly encrypts the sub-data units to form irreversibly encrypted sub-data units, reversibly encrypts the raw data to form a reversibly encrypted data unit, and stores each irreversibly encrypted sub-data unit and the reversibly encrypted data unit as associated pairs. Processor 512 can be further configured to compress the irreversibly encrypted sub-data units and the associated reversibly encrypted data unit.

Communication interface 514 receives to-be-decrypted data (reversibly encrypted data unit). Processor 512 decrypts, according to the reversible encryption algorithm, the reversibly encrypted data unit to obtain raw data, and determines the raw data and the irreversibly encrypted sub-data as decrypted data.

Communication interface 514 also receives an input query word. Processor 512 encrypts, according to an irreversible encryption algorithm, the query word to obtain an encrypted query word, and matches the encrypted query word against stored encrypted data to obtain query result data. The stored encrypted data cars be obtained by partitioning raw data into sub-data units, and encrypting the sub-data units with the irreversible encryption algorithm.

Processor 512 irreversibly encrypts, with an irreversible encryption algorithm, the query word to obtain an encrypted query word by determining a fixed length needing to be partitioned, partitioning, according to the fixed length, the query word into at least one sub-query word, and encrypting, according to the irreversible encryption algorithm, the at least one sub-query word to obtain encrypted sub-query words.

In addition, processor 512 matches the encrypted query word against encrypted date to obtain query result data by matching the encrypted query word against the stored encrypted data to obtain matching target sub-data, using the raw data corresponding to the target sub-data as reference data to verify the target sub-data, and using successfully verified target sub-data as the query result data.

Further, processor 512 uses the raw data corresponding to the target sub-data as reference data to verify the target sub-data by obtaining at least one piece of target data to which the target sub-data belongs, decrypting the at least one piece of target data to obtain at least one piece of raw data corresponding to the at least one piece of tar get data, and using a determination result as to whether the query word matches the at least one piece of raw data as a verification result of the encrypted data.

FIG. 6 shows a block diagram that illustrates a data device 600 in accordance with the present invention. As shown in FIG. 6, device 600 includes a communication interface 610 that receives a data query request of a user, sends to a server a query word included In a data obtaining request, and receives query results returned by the server, wherein the query results are obtained by: encrypting, according to an irreversible encryption algorithm, the query word to obtain an encrypted query word, and matching the encrypted query word against encrypted data to obtain query result data.

Device 600 also includes a display screen 620, which is coupled to communication interface 610 via a communication bus 630, that displays the query result data on a result page, wherein the encrypted data Is obtained by partitioning raw data into sub-data, and encrypting the sub-data with the irreversible encryption algorithm.

The embodiment of the present application further discloses a computer-readable medium which has stored thereon a program for enabling a computer to perform data encryption. The data encryption includes a partitioning step: partitioning raw data into sub-data units, and an encryption step: encrypting, with an irreversible encryption algorithm, the sub-data units to obtain encrypted sub-data units.

The embodiment of the present application further discloses a computer-readable medium which has stored thereon a program for enabling a computer to perform data decryption. The data decryption Includes a receiving step: receiving to-be-decrypted data. The to-be-decrypted data including target data encrypted with a reversible encryption algorithm and encrypted sub-data. The data decryption also includes a decryption step: decrypting, according to the reversible encryption algorithm, the target data to obtain raw data, and a determination step: determining the raw data and the encrypted sub-data as decrypted data.

The embodiment of the present application further discloses a computer-readable medium which has stored thereon a program for enabling a computer to perform a data query. The data query includes a receiving step: receiving an inputted query word, an encryption step: encrypting, according to an irreversible encryption algorithm (the query word to obtain an encrypted query word), and a matching step: matching the encrypted query word against encrypted data to obtain query result data. The encrypted data is obtained by: partitioning raw data into sub-data; and encrypting the sub-data with the irreversible encryption algorithm.

The embodiment of the present application further discloses a computer-readable medium which has stored thereon a program for enabling a computer to perform a data query. The data query includes a sending step; sending to a server a query word included in a data obtaining request after receiving a data query request of a user, and a receiving step: receiving query results returned by the server and displaying the query results on a result page.

The query results are obtained by; encrypting, according to an irreversible encryption algorithm (the query word to obtain an encrypted query word), and matching the encrypted query word against encrypted data to obtain query result data. The encrypted data is obtained by: partitioning raw data into sub-data, and encrypting the sub-data with the irreversible encryption algorithm.

It should be noted that the embodiments in the specification are described progressively with each embodiment emphasizing a part different from other embodiments. Identical or similar parts of the embodiments may be obtained by referring to one another. Because the device embodiments are substantially similar to the method embodiments, the description for the device embodiments is relatively concise, and reference can be made to the description of the method embodiments for related parts.

Finally, it should be further noted that in this text, the relation terms such as first and second are merely used to distinguish one entity or operation from another entity or operation, and do not require or imply that the entities or operations have this actual relation or order. Moreover, the terms “include,“”comprise,” or other variations thereof are intended to cover non-exclusive inclusion, so that a process, a method, an article, or a device including a series of elements not only includes the elements, but also includes other elements not clearly listed, or further includes inherent elements of the process, method, article, or device. The element defined by the statement “including one,” without further limitation, does not preclude the presence of additional identical elements in the process, method, commodity, or device that includes the element.

The data encryption, decryption and query methods provided in the present application are introduced above in detail The principles and implementation manners of the present application are set forth herein with reference to specific examples. Descriptions of the above embodiments are merely served to assist In understanding the method and the essential ideas of the present application. Those of ordinary skill in the art may make changes to specific Implementation manners and application scopes according to the ideas of the present application. In view of the above, the content of the description should not be construed as limiting the present application. 

What is claimed is:
 1. A data processing method comprising; receiving a string of raw data; partitioning the string of raw data to form a plurality of raw substrings; irreversibly encrypting the plurality of raw substrings to form a plurality of Irreversibly encrypted substrings; reversibly encrypting the string of raw data to form a string of reversibly encrypted raw data; associating the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring is associated with the string of reversibly encrypted raw data; and storing the plurality of irreversibly encrypted substrings as a plurality of stored Irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each irreversibly encrypted substring as a stored reversibly encrypted string,
 2. The method of claim 1, further comprising; receiving a query word; partitioning the query word to form a plurality of sub-query words; irreversibly encrypting the plurality of sub-query words to form a plurality of irreversibly encrypted sub-query words; searching the plurality of stored irreversibly encrypted substrings with the plurality of irreversibly encrypted sub-query words to find stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words such that each Irreversibly encrypted sub-query word has a matching stored irreversibly encrypted substring; and outputting the stored reversibly encrypted strings that are associated with the stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words as a query result.
 3. The method of claim 2, wherein the stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words are output with the stored reversibly encrypted strings.
 4. The method of claim 2, wherein the query word is partitioned using a sliding window.
 5. The method of claim 1, wherein the string of raw data is partitioned using the sliding window.
 6. The method of claim 2, wherein multiple stored irreversibly encrypted substrings match a single Irreversibly encrypted sub-query word.
 7. The method of claim 6, further comprising: decrypting the stored reversibly encrypted strings associated with the multiple stored Irreversibly encrypted substrings to form a plurality of decrypted strings; determining which of the decrypted strings matches an unencrypted query word; and for each match, adding the corresponding irreversibly encrypted substring and associated reversibly encrypted string to the query result.
 8. A non-transitory computer-readable storage medium hewing embedded therein program instructions, which when executed by a processor, causes the processor to execute a method of data processing, the method comprising; receiving a string of raw data; partitioning the string of raw data to form a plurality of raw substrings; irreversibly encrypting the plurality of raw substrings to form a plurality of irreversibly encrypted substrings; reversibly encrypting the string of raw data to form a string of reversibly encrypted raw data; associating the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring is associated with the string of reversibly encrypted raw data; and storing the plurality of irreversibly encrypted substrings as a plurality of stored irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each Irreversibly encrypted substring as a stored reversibly encrypted string.
 9. The medium of claim 8, wherein the method further comprises: receiving a query word; partitioning the query word to form a plurality of sub-query words; irreversibly encrypting the plurality of sub-query words to form a plurality of irreversibly encrypted sub-query words; searching the plurality of stored irreversibly encrypted substrings with the plurality of irreversibly encrypted sub-query words to find stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words such that each irreversibly encrypted sub-query word has a matching stored irreversibly encrypted substring; and outputting the stored reversibly encrypted substrings that are associated with the stored Irreversibly encrypted substrings that match the irreversibly encrypted sub-query words as a query result.
 10. The medium of claim 9, wherein the stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words are output with the stored reversibly encrypted strings.
 11. The medium of claim 9, wherein the query word is partitioned using a sliding window.
 12. The medium of claim 8, wherein the string of raw data Is partitioned using the sliding window.
 13. The medium of claim 9, wherein multiple stored irreversibly encrypted substrings match a single irreversibly encrypted sub-query word.
 14. The medium of claim 13, further comprising: decrypting the stored reversibly encrypted substrings associated with the multiple stored irreversibly encrypted substrings to form a plurality of decrypted substrings; determining which of the decrypted substrings matches an unencrypted query word; and for each match, adding the corresponding irreversibly encrypted substring and associated reversibly encrypted string to the query result.
 15. A data device comprising: a memory that stores instructions and data in a data structure; a processor coupled to the memory, the processor to: receive a string of raw data; partition the string of raw data to form a plurality of raw substrings; irreversibly encrypt the plurality of raw substrings to form a plurality of irreversibly encrypted substrings; reversibly encrypt the string of raw data to form a string of reversibly encrypted raw data; associate the plurality of irreversibly encrypted substrings with the string of reversibly encrypted raw data such that each irreversibly encrypted substring is associated with the string of reversibly encrypted raw data; and store the plurality of irreversibly encrypted substrings as a plurality of stored irreversibly encrypted substrings, and the string of reversibly encrypted raw data associated with each irreversibly encrypted substring as a stored reversibly encrypted string.
 16. The device of claim 15, wherein the processor to further: receive a query word; partition the query word to form a plurality of sub-query words; irreversibly encrypt the plurality of sub-query words to form a plurality of irreversibly encrypted sub-query words; search the plurality of stored irreversibly encrypted substrings with the plurality of irreversibly encrypted sub-query words to find stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words such that each irreversibly encrypted sub-query word has a matching stored irreversibly encrypted substring; and output the stored reversibly encrypted substrings that are associated with the stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words as a query result.
 17. The device of claim 16, wherein the stored irreversibly encrypted substrings that match the irreversibly encrypted sub-query words are output with the stored reversibly encrypted strings.
 18. The device of claim 16, wherein the query word is partitioned using a sliding window.
 19. The device of claim 16, wherein the string of raw data Is partitioned using the sliding window.
 20. The device of claim 19, wherein multiple stored irreversibly encrypted substrings match a single irreversibly encrypted sub-query word; and the processor to further; decrypt the stored reversibly encrypted strings associated with the multiple stored irreversibly encrypted substrings to form a plurality of decrypted strings; determine which of the decrypted substrings matches an unencrypted query word; and for each match, add the corresponding irreversibly encrypted substring and associated reversibly encrypted string to the query result. 